package org.opencv.samples.tutorial4;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.Window;

public class Sample4Mixed extends Activity {
    private static final String TAG                = "Sample::Activity";

    public static final int     DIALOG_TUTORIAL_FAST = 0;
    public static final int     DIALOG_TUTORIAL_SURF = 1;
    public static final int     DIALOG_TUTORIAL_STAR = 2;
    public static final int     DIALOG_TUTORIAL_MSER = 5;

    private MenuItem            mItemFast;
    private MenuItem            mItemSurf;
    private MenuItem            mItemStar;
    private MenuItem            mItemMser;

    public static int           viewMode           = DIALOG_TUTORIAL_FAST;

    public Sample4Mixed() {
        Log.i(TAG, "Instantiated new " + this.getClass());
    }

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Log.i(TAG, "onCreate");
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(new Sample4View(this));
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        Log.i(TAG, "onCreateOptionsMenu");
        mItemFast = menu.add("FAST");
        mItemSurf = menu.add("SURF");
        mItemStar = menu.add("STAR");
        mItemMser = menu.add("MSER");
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        Log.i(TAG, "Menu Item selected " + item);
        if (item == mItemFast)
            viewMode = DIALOG_TUTORIAL_FAST;
        else if (item == mItemSurf)
            viewMode = DIALOG_TUTORIAL_SURF;
        else if (item == mItemStar)
            viewMode = DIALOG_TUTORIAL_STAR;
        else if (item == mItemMser)
            viewMode = DIALOG_TUTORIAL_MSER;
        return true;
    }
}
